package com.example.javaeekeshe.utils.messageUtils.impl;

import com.example.javaeekeshe.utils.messageUtils.IRandomMessageUtils;
import org.springframework.stereotype.Repository;

import java.util.Random;

@Repository
public class RandomMessageImpl implements IRandomMessageUtils {
    private final char[] s="23456789qwertyupasdfghjkzxcvbnm".toCharArray();
    @Override
    public String getRandomMessage() {
        char[] messageChar = new  char[4];
        for (int i = 0; i < messageChar.length; i++) {
            messageChar[i]=s[new Random().nextInt(s.length)];
        }
        return new String(messageChar);
    }
}
